<head>
    <meta charset="UTF-8">
    <script src="/js/vue.js"></script>
    <script src="/js/axios.js"></script>
</head>
<body>
<div id="d">
    用户名<input  v-model="username"><br>
    密码<input placeholder="密码" v-model="password"><br>
    <input type="button" @click="login" value="登录">

</div>
<script>
    new Vue({
        el:'#d',
        data:{
            username:'',
            password:''
        },
        methods:{
            login(){
                axios.get('http://localhost/user/login',{
                    params:{
                        username:this.username,
                        pass:this.password
                    }
                }).then(ret=>{
                    if(ret.data){
                        location.href='http://localhost/html/demo2/product.html'
                    }
                });
            }
        }
    })
</script>
</body>